<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <main>
      <a href="http://www.houdunren.hdcms">开源系统.com</a>
      <a href="http://houdunren.houdunren">后盾人</a>
      <a href="http://yahsuo.com">雅虎</a>
      <a href="http://houdunren.com"></a>
    </main>
  </body>
</html>

<script>
  const main = document.querySelector("body main");
  const reg = /(<a.*href=['"])(http)(:\/\/)(www\.)?(hdcms|houdunren)/gi;
  main.innerHTML = main.innerHTML.replace(reg, (v, ...args) => {
    args[1] += "s";
    console.log(args[1]);

    args[3] = args[3] || "www.";
    return args.splice(0, 5).join("");
  });
</script>
